<template>
  <a-drawer
    width="576"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{height:'calc(100vh - 100px)',overflow:'auto'}"
    @close="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32">
          <a-col :lg="12" :md="12" :sm="24">
            <a-form-model-item label="上级节点" prop="parentId">
              <a-tree-select
                v-model="form.parentId"
                style="width: 100%"
                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                :tree-data="bizProductCategoryOptions"
                placeholder="请选择"
                :replaceFields="{ children: 'children', title: 'categoryName', key: 'id', value: 'id' }"
                tree-default-expand-all
              >
              </a-tree-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="32">
          <a-col :span="12">
            <a-form-model-item label="分类名称" prop="categoryName">
              <a-input v-model="form.categoryName" placeholder="请输入分类名称"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="排序" prop="treeSort">
              <a-input-number v-model="form.treeSort" :min="0" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="分类类型" prop="categoryType">
              <a-select
                placeholder="请选择分类类型"
                v-model="form.categoryType"
                :getPopupContainer="
                  triggerNode => {
                    return triggerNode.parentNode || document.body
                 }
                "
                style="width: 100%"
                allow-clear>
                <a-select-option v-for="(d, index) in categoryTypeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
              </a-select>
            </a-form-model-item>
           </a-col>
          <a-col :span="12">
            <a-form-model-item label="备注" prop="remark">
              <a-textarea v-model="form.remark" placeholder="请输入备注" :rows="4"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button :disabled="disabled" @click="cancel">
            取消
          </a-button>
          <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
            保存
          </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import BizProductCategoryEditForm from './BizProductCategoryForm'
export default {
  ...BizProductCategoryEditForm
}
</script>
